home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / Peon / PeonSDK-Win32-1.0.0.exe / {app} / PeonMain / include / CEGUI / CEGUIFont_xmlHandler.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-07  |  5.9 KB  |  115 lines

  1. /************************************************************************
  2. filename:     CEGUIFont_xmlHandler.h
  3. created:    21/2/2004
  4. author:        Paul D Turner
  5.  
  6. purpose:    Defines interface for the Font class
  7. *************************************************************************/
  8. /*************************************************************************
  9. Crazy Eddie's GUI System (http://www.cegui.org.uk)
  10. Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  11.  
  12. This library is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU Lesser General Public
  14. License as published by the Free Software Foundation; either
  15. version 2.1 of the License, or (at your option) any later version.
  16.  
  17. This library is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20. Lesser General Public License for more details.
  21.  
  22. You should have received a copy of the GNU Lesser General Public
  23. License along with this library; if not, write to the Free Software
  24. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25. *************************************************************************/
  26. #ifndef _CEGUIFont_xmlHandler_h_
  27. #define _CEGUIFont_xmlHandler_h_
  28.  
  29. #include "CEGUIFont.h"
  30. #include "CEGUIXMLHandler.h"
  31.  
  32. // Start of CEGUI namespace section
  33. namespace CEGUI
  34. {
  35.  
  36. /*!
  37. \brief
  38. Handler class used to parse the Font XML files using SAX2
  39. */
  40. class Font_xmlHandler : public XMLHandler
  41. {
  42. public:
  43.     /*************************************************************************
  44.     Construction & Destruction
  45.     *************************************************************************/
  46.     /*!
  47.     \brief
  48.     Constructor for Font::xmlHandler objects
  49.  
  50.     \param font
  51.     Pointer to the Font object creating this xmlHandler object
  52.     */
  53.     Font_xmlHandler(Font* font) : d_font(font) {}
  54.  
  55.     /*!
  56.     \brief
  57.     Destructor for Font::xmlHandler objects
  58.     */
  59.     virtual ~Font_xmlHandler(void) {}
  60.  
  61.     /*************************************************************************
  62.     SAX2 Handler overrides
  63.     *************************************************************************/
  64.     /*!
  65.     \brief
  66.     document processing (only care about elements, schema validates format)
  67.     */
  68.     virtual void elementStart(const String& element, const XMLAttributes& attributes);
  69.     virtual void elementEnd(const String& element);
  70.  
  71. private:
  72.     /*************************************************************************
  73.     Implementation Constants
  74.     *************************************************************************/
  75.     // XML related strings
  76.     static const String FontElement;                    //!< Tag name for Font elements.
  77.     static const String MappingElement;                //!< Tag name for Mapping elements.
  78.     static const String FontTypeStatic;                //!< Value used for FontTypeAttribute for a static (bitmapped) font.
  79.     static const String FontTypeDynamic;                //!< Value used for FontTypeAttribute for a dynamic (true-type) font.
  80.     static const String GlyphElement;                    //!< Tag name for Glyph elements.
  81.     static const String GlyphRangeElement;            //!< Tag name for GlyphRange elements.
  82.     static const String GlyphSetElement;                //!< Tag name for GlyphSet elements.
  83.     static const char    FontNameAttribute[];            //!< Attribute name that stores the name of the Font
  84.     static const char    FontFilenameAttribute[];        //!< Attribute name that stores the filename, this is either an Imageset xml file, or a font file.
  85.     static const char    FontResourceGroupAttribute[];   //!< Attribute name that stores the resource group identifier used when loading font file.
  86.     static const char    FontTypeAttribute[];            //!< Attribute name that stores the type of font being defined (either static or dynamic).
  87.     static const char    FontSizeAttribute[];            //!< Attribute name that stores the point size for a dynamic font.
  88.     static const char    FontFirstCodepointAttribute[];    //!< Attribute name that stores the first code-point for a dynamic font.
  89.     static const char    FontLastCodepointAttribute[];    //!< Attribute name that stores the last code-point for a dynamic font.
  90.     static const char    FontNativeHorzResAttribute[];    //!< Optional attribute that stores 'native' horizontal resolution for the Font.
  91.     static const char    FontNativeVertResAttribute[];    //!< Optional attribute that stores 'native' vertical resolution for the Font.
  92.     static const char    FontAutoScaledAttribute[];        //!< Optional attribute that specifies whether the Font should be auto-scaled.
  93.     static const char    FontAntiAliasedAttribute[];        //!< Optional attribute that specifies whether the TTF based font should be anti-aliased.
  94.     static const char    MappingCodepointAttribute[];    //!< Attribute name that stores the Unicode code-point for a mapping.
  95.     static const char    MappingImageAttribute[];        //!< Attribute name that stores the Image name for a mapping.
  96.     static const char    MappingHorzAdvanceAttribute[];    //!< Attribute name that stores the horizontal advance for a glyph.
  97.     static const char    GlyphCodepointAttribute[];                //!< Attribute name that stores the U+ codepoint to add to the set.
  98.     static const char    GlyphRangeStartCodepointAttribute[];    //!< Attribute name that stores the U+ codepoint for the start of a range.
  99.     static const char    GlyphRangeEndCodepointAttribute[];        //!< Attribute name that stores the U+ codepoint for the end of a range.
  100.     static const char    GlyphSetGlyphsAttribute[];                //!< Attribute name that stores the UTF8 encoded codepoint set.
  101.  
  102.     // general constants
  103.     static const int    AutoGenerateHorzAdvance;        //!< Horizontal advance value that tells the parser to auto-calculate some reasonable value.
  104.  
  105.     /*************************************************************************
  106.     Implementation Data
  107.     *************************************************************************/
  108.     Font*    d_font;            //!< Font object that we are helping to build
  109.     String    d_glyphSet;        //!< String holding the set of codepoints to be available.
  110. };
  111.  
  112. } // End of  CEGUI namespace section
  113.  
  114. #endif
  115.